package net.appsec.webapp.business;

import net.appsec.webapp.bean.Customer;
import net.appsec.webapp.dao.CustomerDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerBusiness {

	@Autowired
	private CustomerDAO customerDAO;

	public Customer find(Customer customer) {
		Customer _customer = this.customerDAO.get(customer);
		return _customer;
	}

	public boolean add(Customer customer) {
		try {
			return this.customerDAO.add(customer);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}

	public Customer get(Integer id) {
		return this.customerDAO.load(id);
	}

	public boolean save(Customer customer) {
		try {
			return this.customerDAO.update(customer);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
}